package org.simple.learning.spring.boot.aop;

import org.simple.learning.spring.boot.aop.service.AService;
import org.simple.learning.spring.boot.aop.service.BService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 项目名称：spring-boot-leaning
 * 类名称：SpringBootAopApplication
 * 类描述：SpringBootAopApplication
 * 创建时间：2018/12/6
 *
 * @author guihuo   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
@SpringBootApplication
public class SpringBootAopApplication implements CommandLineRunner {

    @Autowired
    private AService aService;

    public static void main(String[] args) {
        SpringApplication.run(SpringBootAopApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        aService.say();

        BService bService = (BService) this.aService;
        bService.print();
    }

}
